/*
 * @Author: hucc
 * @Date: 2021-09-28 11:35:15
 * @LastEditors: hucc
 * @LastEditTime: 2021-09-28 11:52:49
 * @Description: 
 */
//计算图形面积
let shapes = {
    SJX: Symbol("三角形"),
    JX: Symbol("矩形"),
    YX: Symbol("圆形")
}

function computedArea(shape, options) {
    let result = 0;
    switch (shape) {
        case "shapes.SXJ":
            result = .5 * options.width * options.height
            break;
        case "shapes.JX":
            result = options.width * options.height
            break;
        case "shapes.YX":
            result = Math.PI * options.r * options.r
            break;
        default:
            result = -1
            break;
    }
    return result;
}
console.log(computedArea("shapes.SXJ", { width: 20, height: 10 }));